import Vue from 'vue'
import VueRouter from 'vue-router'


Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: 'login'
  },
  {
    path: '/login',
    name: 'Login',
    component: ()=> import('@/views/Login.vue')
  },
  {
    path: '/main',
    name: 'Main',
    component: ()=> import('@/views/Main.vue'),
    children: [
      //系统管理
      {
        path: '/users',
        component: () => import('@/views/user/User.vue'),
        meta:{title: '用户管理'},
      },
      {
        path: '/welcome',
        name: 'Welcome',
        component: () => import('@/views/Welcome.vue'),
        meta:{title: '欢迎页面'}
      },
      {
        path: '/userProfile',
        name: 'UserProfile',
        component: () => import('@/views/user/UserProfile.vue'),
        meta:{title: '个人中心'}
      },
      {
        path: '/attachments',
        name: 'Attachments',
        component: () => import( '@/views/files/Files.vue'),
        meta:{title: '附件管理'}
      },
      {
        path: '/menus',
        name: 'Menu',
        component: () => import('@/views/menu/Menu.vue'),
        meta:{title: '权限管理'}
      },
      {
        path: '/roles',
        name: 'Role',
        component: () => import('@/views/role/Role.vue'),
        meta: {title: '角色管理'}
      },
      {
        path: '/departments',
        name: 'Department',
        component: () => import('@/views/dept/Department.vue'),
        meta: {title: '部门管理'}
      },
      {
        path: '/logs',
        name: 'Logs',
        component: () => import('@/views/log/Log.vue'),
        meta: {title: '日志管理'}
      },
      {
        path: '/loginLog',
        name: 'LoginLog',
        component: () => import('@/views/log/LoginLog.vue'),
        meta: {title: '登入日志'}
      },
      //物资管理
      {
        path: '/inStocks',
        name: 'inStock',
        component: () => import('@/views/biz/product/InStocks.vue'),
        meta: {title: '物资管理'}
      },
      {
        path: '/products',
        name: 'Products',
        component: () => import('@/views/biz/product/Products.vue'),
        meta: {title: '物资资料'}
      },
      {
        path: '/outStocks',
        name: 'OutStocks',
        component: () => import('@/views/biz/product/OutStock.vue'),
        meta: {title: '物资发放'}
      },
      {
        path: '/productCategorys',
        name: 'productCategory',
        component: () => import('@/views/biz/product/ProductCategory.vue'),
        meta: {title: '物资类别'}
      },
      {
        path: '/stocks',
        name: 'Stocks',
        component: () => import('@/views/biz/product/Stocks.vue'),
        meta: {title: '物资库存'}
      },
      {
        path: '/consumers',
        name: 'Consumers',
        component: () => import('@/views/biz/flow/Consumers.vue'),
        meta: {title: '物资流向'}
      },
      {
        path: '/suppliers',
        name: 'Suppliers',
        component: () => import('@/views/biz/flow/Suppliers.vue'),
        meta: {title: '物资来源'}
      },
      //健康报备
      {
        path: '/map',
        name: 'Map',
        component: () => import('@/views/covid19/Map.vue'),
        meta: {title: '全国疫情'}
      },
      {
        path: '/health',
        name: 'Health',
        component: () => import('@/views/covid19/Health.vue'),
        meta: {title: '健康打卡'}
      },
      //其他部分
      {
        path: '/swagger',
        name: 'Swagger',
        component: () => import('@/views/others/Swagger.vue'),
        meta: {title: 'Swagger'},
      },
      {
        path: '/icons',
        name: 'Icons',
        component: () => import('@/views/others/Icons.vue'),
        meta: {title: 'Icons'},
      },
      {
        path: '/blog',
        name: 'Blogs',
        component: () => import('@/views/others/blog.vue'),
        meta: {title: 'Blog'},
      }
    ]
  },
  {
    path : '/404',
    name: '404',
    component: () => import('@/views/error/404.vue'),
    meta:{title: '错误页面'}
  },
  {
    path : '/401',
    name : '401',
    component: () => import('@/views/error/401.vue'),
    meta: {title: '错误页面'}
  }
]

const router = new VueRouter({
  routes
})

export default router
